var app = angular.module('FusionV3', []);

app.controller('loginController', ['$scope', '$http', function($scope, $http) {

	$scope.checkLogin = function() {

		$http.post("rest/account/login", {
			userName : $scope.userName,
			password : $scope.password
		}).success(function(data) {
			
			if (data.result) {
				window.location.href = "server/server";
			} else {
			if(!$scope.userName){
				$scope.msg="Username Error!";
				$('.alert').fadeIn();
			}else
				$scope.msg="Password Error!";
				$('.alert').fadeIn();
				
			}

		}).error(function(data) {
			console.log(data);
		});

	}

}]);